<?php
class Pxy_jsset_ctl extends Ctl{
    function __construct(){
    }
    function main(array $xxfget) {
        $this::sessver();
        $type=!empty($_POST['type'])?$_POST['type']:false;
        if(!$type){
            $pid=$xxfget['pid'];
        	$result=xdb::getInstance()->getarray('select * from peixunjiaoshi');
        	$this::show('pxy_jsset',compact('result','pid'));
        }elseif ($type=="add"){
        	$array=array();
        	$array2=array();
        	$workunit = $_POST['workunit'];
            $tname = $_POST['tname'];
            $shengri = $_POST['shengri'];
            $mphone = $_POST['mphone'];
            $biyeschool = $_POST['biyeschool'];
            $zhuanye = $_POST['zhuanye'];
            $zhicheng = $_POST['zhicheng'];
            $wenhua = $_POST['wenhua'];
            $zhuanyeage = $_POST['zhuanyeage'];
            $jiaoxueage = $_POST['jiaoxueage'];
        	$array['workunit'] = $workunit;
            $array['tname'] = $tname;
            $array['shengri'] = $shengri;
            $array['mphone'] = $mphone;
            $array['biyeschool'] = $biyeschool;
            $array['zhuanye'] = $zhuanye;
            $array['zhicheng'] = $zhicheng;
            $array['wenhua'] = $wenhua;
            $array['zhuanyeage'] = $zhuanyeage;
            $array['jiaoxueage'] = $jiaoxueage;
        	$array2['tname']=$tname;
        	echo xdb::getInstance()->indb('peixunjiaoshi', $array, $array2);
        }elseif ($type=="del"){
        	$array=array();
        	$id=$_POST['pid'];
        	$array['id']=$id;
        	echo xdb::getInstance()->deldb('peixunban', $array);
        }
    }
}